package com.wr.service.article;

import com.wr.dao.ArticleDao;
import com.wr.model.Article;
import com.wr.model.RestResponse;
import com.wr.utils.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author weirong
 * @Title:
 * @Description:
 * @date 2018/6/1118:15
 */
@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;

    public Article detail(Integer id) {
        RestResponse<Article> rest = articleDao.detail(id);

        return rest.getResult();
    }

    public RestResponse<Article> add(Article article) {
        return articleDao.add(article);
    }

    @Override
    public List<Article> mainList(Integer pageNo, Integer pageSize) {
        RestResponse<List<Article>> rest = articleDao.mainList(pageNo,pageSize);
        return rest.getResult();
    }

    @Override
    public List<Article> listPd(PageData pd) {
        RestResponse<List<Article>> rest = articleDao.listPd(pd);

        return rest.getResult();
    }
}
